<div class="panel panel-default">
  <!-- Default panel contents -->
  <div class="panel-heading">巡展基金结算申请</div>
  <div class="panel-body mb27">
  <div style="<?php if (in_array($action, array('edit','audit'))) {?>width: 850px; float: left;<?php }?>" class="table-responsive">
  <table class="table table-bordered"  style="white-space: nowrap;">
    <thead>
      <tr>
        <th class="bg-primary text-center">流水号</th>
        <th class="bg-primary text-center">车展级别</th>
        <th class="bg-primary text-center">开始时间</th>
        <th class="bg-primary text-center">结束时间</th>
        <th class="bg-primary text-center">订单目标</th>
        <th class="bg-primary text-center">留资目标</th>
        <th class="bg-primary text-center">订单实际达成</th>
        <th class="bg-primary text-center">留资实际达成</th>
        <th class="bg-primary text-center">订单目标达成率</th>
        <th class="bg-primary text-center">留资目标达成率</th>
        <th class="bg-primary text-center">车展结算资料上传</th>
        <th class="bg-primary text-center">申请结算费用</th>
        <th class="bg-primary text-center">结算审核费用</th>
        <th class="bg-primary text-center">区域审核情况</th>
        <th class="bg-primary text-center">总部审核情况</th>
        <th class="bg-primary text-center">备注</th>
      </tr>
    </thead>
    <tbody>
    <?php foreach($projectList as $k => $v): ?>
      <tr style="line-height:34px;">
        <td class="text-center"><?php echo $v['id'] ?></td>
        <td class="text-center"><?php echo $v['levelIdStr'] ?></td>
        <td class="text-center"><?php echo $v['startTime'] ?></td>
        <td class="text-center"><?php echo $v['endTime'] ?></td>
        <td class="text-center"><?php echo $v['orderTarget'] ?></td>
        <td class="text-center"><?php echo $v['capitalTarget'] ?></td>
        <td class="text-center"><?php echo $v['orderActual'] ?></td>
        <td class="text-center"><?php echo $v['capitalActual'] ?></td>
        <td class="text-center"><?php echo (float)$v['orderReachRate'] ? $v['orderReachRate'] : 0 ?>%</td>
        <td class="text-center"><?php echo (float)$v['capitalReachRate'] ? $v['capitalReachRate'] : 0 ?>%</td>
        <td class="text-center">
        <?php if ($v['settleVoucher']): ?>
          <a type="button" class="btn btn-default" href="<?=printUrl('Upload','download',array('fileId'=>$v['settleVoucher']['id']))?>" aria-label="Left Align" role="button">
            <span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span>
            附件下载
          </a>
        <?php endif ?>
        </td>
        <td class="text-center"><?php echo $v['settleApply'] ?></td>
        <td class="text-center"><?php echo $v['settleAudit'] ?></td>
        <td class="text-center"><?php echo $v['settleAuditAreaStr'] ?></td>
        <td class="text-center"><?php echo $v['settleAuditHeadStr'] ?></td>
        <td class="text-center"><?php echo $v['remarks'] ?></td>
      </tr>
    <?php endforeach; ?>
    </tbody>
  </table>
  </div>
  <?php if (in_array($action, array('edit','audit'))) {?>
  <div style="width: 150px; float: right;">
    <table class="table table-bordered">
    <thead>
      <tr>
        <?php if (in_array($action, array('audit'))) {?>
        <th class="bg-primary text-center">审核结果</th>
        <?php } ?>
        <th class="bg-primary text-center">操作</th>
        </tr>
    </thead>
    <tbody>
      <?php foreach($projectList as $k => $v): ?>
      <tr>
        <?php if (in_array($action, array('edit'))) {?>
          <td class="text-center">
            <!-- 没有预算审核，以结算审核为判断基准 -->
            <?php if (in_array($v['settleAuditRs'], array(-1,0,3) )) {?>
            <a class="btn btn-default" onclick="newWindow('巡展基金结算申请','<?=printUrl('XunProject','settleEdit', array('id'=>$v['id']))?>',500,500)" role="button">结算</a>
            <?php }else{echo '&nbsp;';} ?>
          </td>
          <?php } ?>
          <?php if (in_array($action, array('audit'))) {?>
          <td class="text-center">
            <?php
            $options = $this->userLib->getSettleAuditOptions();
            $extra = ' id="projectBudgetAuditRs_'.$v['id'].'" class="form-control settleAuditRs" style="width:70px;" money="'.((float)$v['settleAudit'] ? $v['settleAudit'] : $v['settleApply']).'" ';
            if ($this->user['userRole'] < $v['settleAuditRole']) {
              $extra .= " disabled";
            }
            echo form_dropdown('project['.$v['id'].'][settleAuditRs]', $options, $v['settleAuditRs'], $extra);
            ?>
          </td>
          <td>
            <button class="btn btn-default btn-danger" style="width: 50px;" type="button" onclick="ajaxConfirmSubmit('你确定提交审核么？','<?=printUrl('XunSettle','adminAudit')?>',{procId:<?=$v['procId']?>,project:{<?=$v['id']?>:{settleAuditRs:$('#projectBudgetAuditRs_<?=$v['id']?>').val()}}})">审核</button>&nbsp;
          </td>
          <?php } ?>
        </tr>
        <?php endforeach; ?>
    </tbody>
    </table>
  </div>
  <?php } ?>
  </div>
</div>